﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;

namespace HeathCareSystem
{
    public class NguoiDungDAO
    {
        DataProvider dp = new DataProvider();

        public List<NguoiDungDTO> LayDanhSachBacSi()
        {
            List<NguoiDungDTO> listKetQua = new List<NguoiDungDTO>();
            NguoiDungDTO ndDTO = new NguoiDungDTO();
            DataTable dt = new DataTable();
            string strSQL = string.Format("SELECT NguoiDung.MaNguoiDung, NguoiDung.HoTen " +
                                          "FROM TaiKhoan INNER JOIN NguoiDung ON TaiKhoan.MaTaiKhoan = NguoiDung.MaTaiKhoan");
            dt = dp.ExecuteQuery(strSQL);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ndDTO = new NguoiDungDTO();
                ndDTO.maNguoiDung = dt.Rows[i][0].ToString();
                ndDTO.hoTen = dt.Rows[i][1].ToString();
                //ndDTO.gioiTinh = dt.Rows[i][2].ToString();
                //ndDTO.ngaySinh = DateTime.Parse(dt.Rows[i][3].ToString());
                //ndDTO.diaChi = dt.Rows[i][4].ToString();
                //ndDTO.soDienThoai = dt.Rows[i][5].ToString();
                //ndDTO.queQuan = dt.Rows[i][6].ToString();
                //ndDTO.hocVi = dt.Rows[i][7].ToString();
                //ndDTO.soNamKinhNghiem = Int32.Parse(dt.Rows[i][8].ToString());
                //ndDTO.maTaiKhoan = Int32.Parse(dt.Rows[i][9].ToString());
                listKetQua.Add(ndDTO);
            }
            return listKetQua;
        } 
    }
}